package com.rzl.expense.quartz.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.rzl.expense.common.annotation.Log;
import com.rzl.expense.common.core.controller.BaseController;
import com.rzl.expense.common.core.domain.AjaxResult;
import com.rzl.expense.common.enums.BusinessType;
import com.rzl.expense.quartz.domain.Task;
import com.rzl.expense.quartz.service.ITaskService;
import com.rzl.expense.common.utils.poi.ExcelUtil;
import com.rzl.expense.common.core.page.TableDataInfo;

/**
 * 任务列表Controller
 *
 * @author expense
 * @date 2024-06-27
 */
@RestController
@RequestMapping("/monitor/task")
public class TaskController extends BaseController
{
    @Autowired
    private ITaskService taskService;

    /**
     * 查询任务列表列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Task task)
    {
        startPage();
        List<Task> list = taskService.selectTaskList(task);
        return getDataTable(list);
    }
    /**
     * 修改任务列表
     */
    @Log(title = "任务列表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Task task)
    {
        return toAjax(taskService.updateTask(task));
    }

    /**
     * 删除任务列表
     */
    @Log(title = "任务列表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(taskService.deleteTaskById(id));
    }
}
